package besta.moon.sql.expression.function.string;

import besta.moon.sql.expression.function.FunctionReturnInt;
import besta.moon.sql.parser.SQLTokenizer;


public final class FunctionCharLen extends FunctionReturnInt {

    @Override
    public final int getFunction() {
        return SQLTokenizer.CHARLEN;
    }

    @Override
    public boolean isNull() throws Exception {
        return param1.isNull();
    }

    @Override
    public final int getInt() throws Exception {
        if (isNull()) {
            return 0;
        }

        String str = param1.getString();

        return str.length();
    }
}
